<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script
        src="https://code.jquery.com/jquery-2.2.4.min.js"
        integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="
        crossorigin="anonymous"></script>
</head>
<body>
<button>按钮</button>
<div></div>
<script>
    $('button').click(function (){
        $.ajax({
            type : 'post',
            url : '5.php',
            data: 'id=1&name=zhangsan',
            beforeSend : function () {
                $('div').html('请等待...')
            },
            success : function (res) {
                $('div').html(res)
            }
        })
    })
</script>
</body>
</html>